import { Component, OnInit } from '@angular/core';
import { HttputilsService } from '../../services/httputils.service';
@Component({
  selector: 'app-http',
  templateUrl: './http.component.html',
  styleUrls: ['./http.component.css']
})
export class HttpComponent implements OnInit {

  constructor(public http: HttputilsService) { }

  ngOnInit() {
    this.http.get('http://127.0.0.1:3001/').then((value) => console.log(value)).catch((err) => console.log(err));
    this.http.post('http://127.0.0.1:3001/post',{username: '张三'}).then(value => console.log(value)).catch(err => console.log(err));
    this.http.jsonp('http://127.0.0.1:3001/jsonp').then(value => console.log(value));
  }


}
